import * as types from '../../mutation-types/search-filter/index';

const state = {
	//我的客户
	myCusBrandList:null,
	mycomplaint:null,
	 myBrandFilter:null,
	myCustomerFilter: null,
	myCustomerCategory: null,
	myCustomerXY:null,
	myCustomerXYSEA:null,
	myCustomerXYNEW:null,
	myCustomerXYBRAND:null,
	myCustomerNUM:[],
	//添加客户
	addCustomerFilter: null,
	addCustomerForm: {
      customerName: '',         //用户名
      customerLevel: '',         //客户类别
      contactName: '',          //联系人
      tel: '',                 //手机号
      customerFrom: '',        //客户来源
      customerIndustry: '',     //所属行业
      kpFlag: '',              //KP标记，0不是关键人，1关键人
      address: '',            //公司详细地址
      userId: '',                  //销售员id
      customerWeb: '',          //	客户网站
      provinceId: '',
      cityId: '',
      areaId: '',
      phone: '',         //电话号码
      qq: '',
      signFlag: ''              //是否标记
    },

    //跟进内容
    followContentCache:[],

	//公海客户
	seasCustomerFilter: null,
	seasCustomerCategory: null,

	//新录资源
	newRecordFilter: null,
	newRecordCategory: null,

	//未接电话
	missedCallFilter: null,
	missedCallUser: null,
	missedCallCategory: null,

	//报表
	reportAddFilter: null,
	reportOwnerFilter: null,
	reportFollowFilter: null,
	reportDestinationFilter: null,
	reportOnlineFilter: null,

	reportFollowContact: null,
	reportAddCategory: null,
	reportOwnerCategory: null,
	reportFollowCategory: null,
	reportDestinationCategory:null,
	reportOnlineCategory: null,

	reportAddDept: null,
	reportOwnerDept: null,
	reportFollowDept: null,
	reportDestinationDept:null,
	reportOnlineDept: null,

	//日历
	calenderFilter: null,
	calenderCategory: null,
	calenderSeller: null,
	//部门权限
	powerSettingFilter: null,
	//岗位管理
	postSettingFilter: null,
	//用户管理
	personSettingFilter: null,
	//呼叫系统管理
	telSystemFilter: null,
};

const mutations = {
	[types.MY_COMPLAINT] (state , {data}){
        state.mycomplaint = data;
    },
	[types.MY_CUS_BRABDLIST] (state , {data}){
        state.myCusBrandList = data;
    },
	[types.MY_BRAND_FILTER] (state , {data}){
        state.myBrandFilter = data;
    },
	[types.MY_CUSTOMER_XY] (state , {data}){
		state.myCustomerXY = data;
	},
	[types.MY_CUSTOMER_XY_SEA] (state , {data}){
		state.myCustomerXYSEA = data;
	},
	[types.MY_CUSTOMER_XY_NEW] (state , {data}){
		state.myCustomerXYNEW = data;
	},
	[types.MY_CUSTOMER_XY_BRAND] (state , {data}){
		state.myCustomerXYBRAND = data;
	},
	[types.MY_CUSTOMER_NUM] (state , {data}){
		state.myCustomerNUM.push(data);
	},
	[types.MY_CUSTOMER_FILTER] (state , {data}){
		state.myCustomerFilter = data;
	},
	[types.MY_BRAND_FILTER] (state , {data}){
		state.myBrandFilter = data;
	},
	[types.MY_CUSTOMER_CATEGORY] (state , {data}){
		state.myCustomerCategory = data;
	},
	[types.ADD_CUSTOMER_FILTER] (state , {data}){
		state.addCustomerFilter = data;
	},
	[types.INIT_ADD_CUSTOMER_FORM] (state , {data}){
		state.addCustomerForm = {
	      customerName: data,         //用户名
	      customerLevel: '',         //客户类别
	      contactName: '',          //联系人
	      tel: '',                 //手机号
	      customerFrom: '',        //客户来源
	      customerIndustry: '',     //所属行业
	      kpFlag: '',              //KP标记，0不是关键人，1关键人
	      address: '',            //公司详细地址
	      userId: '',                  //销售员id
	      customerWeb: '',          //	客户网站
	      provinceId: '',
	      cityId: '',
	      areaId: '',
	      phone: '',         //电话号码
	      qq: '',
	      signFlag: ''              //是否标记
	    };
	},
	[types.FOLLOW_CONTENT_CACHE] (state , {data}){
		let sameCustomer = false;
		if(state.followContentCache.length){
			state.followContentCache.forEach((n)=>{
				if(n.customerName == data.customerName){
					sameCustomer = true;
				}
			})
		}
		if(!sameCustomer){
			state.followContentCache.push(data);
		}
	},

	[types.SEAS_CUSTOMER_FILTER] (state , {data}){
		state.seasCustomerFilter = data;
	},
	[types.SEAS_CUSTOMER_CATEGORY] (state , {data}){
		state.seasCustomerCategory = data;
	},
	[types.NEW_RECORD_FILTER] (state , {data}){
		state.newRecordFilter = data;
	},
	[types.NEW_RECORD_CATEGORY] (state , {data}){
		state.newRecordCategory = data;
	},
	[types.MISSED_CALL_FILTER] (state , {data}){
		state.missedCallFilter = data;
	},
	[types.MISSED_CALL_USER] (state , {data}){
		state.missedCallUser = data;
	},
	[types.MISSED_CALL_CATEGORY] (state , {data}){
		state.missedCallCategory = data;
	},
	[types.REPORT_FOLLOW_CONTACT] (state , {data}){
		state.reportFollowContact = data;
	},
	[types.REPORT_ADD_CATEGORY] (state , {data}){
		state.reportAddCategory = data;
	},
	[types.REPORT_OWNER_CATEGORY] (state , {data}){
		state.reportOwnerCategory = data;
	},
	[types.REPORT_FOLLOW_CATEGORY] (state , {data}){
		state.reportFollowCategory = data;
	},
	[types.REPORT_DESTINATION_CATEGORY] (state , {data}){
		state.reportDestinationCategory = data;
	},
	[types.REPORT_ONLINE_CATEGORY] (state , {data}){
		state.reportOnlineCategory = data;
	},
	[types.REPORT_ADD_DEPT] (state , {data}){
		state.reportAddDept = data;
	},
	[types.REPORT_OWNER_DEPT] (state , {data}){
		state.reportOwnerDept = data;
	},
	[types.REPORT_FOLLOW_DEPT] (state , {data}){
		state.reportFollowDept = data;
	},
	[types.REPORT_DESTINATION_DEPT] (state , {data}){
		state.reportDestinationDept = data;
	},
	[types.REPORT_ONLINE_DEPT] (state , {data}){
		state.reportOnlineDept = data;
	},
	[types.REPORT_ADD_FILTER] (state , {data}){
		state.reportAddFilter = data;
	},
	[types.REPORT_OWNER_FILTER] (state , {data}){
		state.reportOwnerFilter = data;
	},
	[types.REPORT_FOLLOW_FILTER] (state , {data}){
		state.reportFollowFilter = data;
	},
	[types.REPORT_DESTINATION_FILTER] (state , {data}){
		state.reportDestinationFilter = data;
	},
	[types.REPORT_ONLINE_FILTER] (state , {data}){
		state.reportOnlineFilter = data;
	},
	[types.CALENDER_FILTER] (state , {data}){
		state.calenderFilter = data;
	},
	[types.CALENDER_CATEGORY] (state , {data}){
		state.calenderCategory = data;
	},
	[types.CALENDER_SELLER] (state , {data}){
		state.calenderSeller = data;
	},
	[types.POWER_SETTING_FILTER] (state , {data}){
		state.powerSettingFilter = data;
	},
	[types.POST_SETTING_FILTER] (state , {data}){
		state.postSettingFilter = data;
	},
	[types.PERSON_SETTING_FILTER] (state , {data}){
		state.personSettingFilter = data;
	},
	[types.TEL_SYSTEM_FILTER] (state , {data}){
		state.telSystemFilter = data;
	}
}

export default {
	state ,
	mutations
};